summaryrefslogtreecommitdiffstats
path: root/src/video_core/vulkan_common/vulkan_device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_device.cpp')
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 3d2e9a16a..631d5e378 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -22,6 +22,10 @@
#include <adrenotools/bcenabler.h>
#endif
+#define VMA_STATIC_VULKAN_FUNCTIONS 0
+#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
+#include <vk_mem_alloc.h>
+
namespace Vulkan {
using namespace Common::Literals;
namespace {
@@ -592,9 +596,26 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
graphics_queue = logical.GetQueue(graphics_family);
present_queue = logical.GetQueue(present_family);
+
+ const VmaVulkanFunctions functions = {
+ .vkGetInstanceProcAddr = dld.vkGetInstanceProcAddr,
+ .vkGetDeviceProcAddr = dld.vkGetDeviceProcAddr,
+ };
+
+ const VmaAllocatorCreateInfo allocator_info = {
+ .physicalDevice = physical,
+ .device = *logical,
+ .pVulkanFunctions = &functions,
+ .instance = instance,
+ .vulkanApiVersion = VK_API_VERSION_1_1,
+ };
+
+ vk::Check(vmaCreateAllocator(&allocator_info, &allocator));
}
-Device::~Device() = default;
+Device::~Device() {
+ vmaDestroyAllocator(allocator);
+}
VkFormat Device::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage,
FormatType format_type) const {